package com.alibaba.cloud.fooweb;

import com.alibaba.cloud.serviceapi.FooService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Date;

/**
 * <p> Demo </p>
 *
 * @author Chris
 * @since 2022/11/14 17:10
 */
@Service
public class DemoService {

    @DubboReference
    private FooService fooService;

    @GetMapping("/hello")
    public String hello(String name) {
        return fooService.sayHello(name);
    }

    @GetMapping("/time")
    public Date getCurrentTime(Integer slow) {
        return fooService.getCurrentTime(slow);
    }

    @GetMapping("/bonjour/{name}")
    public String bonjour(@PathVariable("name") String name) {
        return "[bonjour] " + name;
    }

}